package org.random;

import java.util.Random;

/**
 * @Author: xwg
 * @CreateDate: 2021/11/26
 */


public class RandomTest {
    public static void main1(String[] args) {
//        取1000到9999 8999
//        取-100到100  200
//
        Random r = new Random();
        for (int i = 0; i < 20; i++) {
            int number = r.nextInt(200) - 100;
//            r.nextInt(6)+1；
//            [0,n) start_with 0  end_before 10
            System.out.println(number);
        }
//        [1,7)   =>1 2 3 4 5 6
//1 2 3 4 5 6 => [1,7)

    }

    //  [80几率 抽个黄色的 19 几率 抽个紫色的 1几率 橙色的]
//    0-------------------80-----99-100
//    sout”抽到紫色“
    public static void main(String[] args) {
        Random random = new Random();

        for (int i = 0; i < 10; i++) {

            int result = random.nextInt(100);

            if (result < 80) {
                System.out.println("抽到黄色：____ " + result);
            } else if (result < 99) {
                System.out.println("抽到紫色: ++++" + result);
            } else {
                System.out.println("抽到橙色：？？？？" + result);
            }
        }
    }
}
